package com.csg.boot.starter.sso.context;

import org.springframework.boot.web.servlet.ServletContextInitializer;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.util.Map;

/**
 * @author george
 */
public class InitParameterInitializer implements ServletContextInitializer {

    private final Map<String, String> parameters;

    public InitParameterInitializer(Map<String, String> parameters) {
        this.parameters = parameters;
    }

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        for (Map.Entry<String, String> entry : this.parameters.entrySet()) {
            servletContext.setInitParameter(entry.getKey(), entry.getValue());
        }
    }

}
